﻿using System;
using System.Collections.Generic;
using System.Web;
using System.Data;

/// <summary>
/// Summary description for NhaDatMenuManager
/// </summary>
public class NhaDatMenuManager
{
    NhaDatMenuDAO nhaDatMenuDao = new NhaDatMenuDAO();
    public NhaDatMenuManager()
    {

    }

    public List<NhaDat> getAllNhaDatMenu()
    {
        List<NhaDat> result = new List<NhaDat>();

        DataTable dt = nhaDatMenuDao.GetNhaDat();
        for (int i = 0; i < dt.Rows.Count; i++)
        {
            NhaDat nd = new NhaDat();
            nd.Ten = Convert.ToString(dt.Rows[i]["Ten"]);
            nd.ID = Convert.ToString(dt.Rows[i]["ID"]);
            result.Add(nd);
        }
        return result;
    }

    public DataTable getAllNhaDatMenuReturnDT()
    {
        DataTable dt = nhaDatMenuDao.GetNhaDat();

        if (dt != null)
            return dt;

        return new DataTable();
    }

    public bool UpdateNhaDat(NhaDat nhaDat)
    {
        return nhaDatMenuDao.UpdateNhaDat(nhaDat);
    }

    public bool DeleteNhaDat(NhaDat nhaDat)
    {
        return nhaDatMenuDao.DeleteNhaDat(nhaDat);
    }

    public bool InsertNhaDat(NhaDat nhaDat)
    {
        return nhaDatMenuDao.InsertNhaDat(nhaDat);
    }
}